import requests
from bs4 import BeautifulSoup
import re
url='https://www.xyyuedu.com/gdmz/sidamingzhu/hlmeng/21651.html'
url_2='https://www.xyyuedu.com/gdmz/sidamingzhu/hlmeng/21651_2.html'
u={'user-anget':'Chrome10/'}
try:
    r = requests.get(url,timeout=30).\
    text.encode("ISO-8859-1").decode('gbk').encode('utf8').decode('utf8')
    r_2 = requests.get(url_2,timeout=30).\
    text.encode("ISO-8859-1").decode('gbk').encode('utf8').decode('utf8')
except:
    pass
Raw_Data=[]
Matching_Results=[]
soup = BeautifulSoup(r,'html.parser')
soup_2 = BeautifulSoup(r_2,'html.parser')
for i in range(19):
    deti=soup.select('p')[i].text
    Raw_Data.append(deti)
for i_2 in range(12):
    deti_2=soup_2.select('p')[i_2].text
    Raw_Data.append(deti_2)
pat = re.compile('(([\u4e00-\u9fa5]{5},[\u4e00-\u9fa5]{5}。|[\u4e00-\u9fa5]{5},[\u4e00-\u9fa5]{5}[?]|[\u4e00-\u9fa5]{5},[\u4e00-\u9fa5]{5}！|[\u4e00-\u9fa5]{7}[?][\u4e00-\u9fa5]{7}。)|([\u4e00-\u9fa5]{7},[\u4e00-\u9fa5]{7}。|[\u4e00-\u9fa5]{7},[\u4e00-\u9fa5]{7}[?]|[\u4e00-\u9fa5]{7},[\u4e00-\u9fa5]{7}！|[\u4e00-\u9fa5]{7}[?][\u4e00-\u9fa5]{7}。))')
for a in range(len(Raw_Data)):
    b=pat.finditer(Raw_Data[a])
    Matching_Results.append(b)
while None in Matching_Results:
    Matching_Results.remove(None)
for c in range(len(Matching_Results)):
    for match in Matching_Results[c]:
        print(match.group(0))
